import request from "@/utils/request";
// import { Result } from "@/types";

class GiftAPI {
  /**
   * 分页获取礼物列表
   */
  static getPage(name: string, pageSize: number, pageNum: number) {
    return request<any, any>({
      url: "/api/gift/page",
      method: "post",
      data: {
        name,
        pageSize,
        pageNum,
      },
    });
  }

  /**
   * 获取所有礼物
   */
  static getAll() {
    return request<any, any>({
      url: "/api/gift/all",
      method: "get",
    });
  }

  /**
   * 根据ID获取礼物详情
   */
  static get(id: number) {
    return request<any, any>({
      url: "/api/gift/get",
      method: "post",
      data: {
        id,
      },
    });
  }

  /**
   * 新增/更新礼物
   */
  static save(data: any) {
    return request<any, any>({
      url: "/api/gift/save",
      method: "post",
      data,
    });
  }

  /**
   * 删除礼物
   */
  static delete(id: number) {
    return request<any, any>({
      url: "/api/gift/delete",
      method: "post",
      data: {
        id,
      },
    });
  }
}

export default GiftAPI;
